﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using OPMS_V1.DOL;

namespace OPMS_V1.Public
{
    public partial class Feedback : System.Web.UI.Page
    {
        /// <summary>
        /// Auto Implemented Property for Feedback Symbol
        /// </summary>
        public string FeedbackSymbol
        { get; set; }
        /// <summary>
        /// Auto Implemented Property for Feedback Symbol
        /// </summary>
        public string FeedbackType
        { get; set; }

        S_PDataContext dc = new S_PDataContext();

        protected void Page_Load(object sender, EventArgs e)
        {
            FeedbackSymbol = Session["Symbol"].ToString();
            pnlFeedbackTechnical.Visible = false;
        }

        /// <summary>
        /// This function is used for assigning the symbol text upon the Symbol Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btncool_Click(object sender, ImageClickEventArgs e)
        {
            Session["Symbol"] = "Cool";
        }

        /// <summary>
        /// This function is used for assigning the symbol text upon the Symbol Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnHappy_Click(object sender, ImageClickEventArgs e)
        {
            Session["Symbol"] = "Happy";
        }

        /// <summary>
        /// This function is used for assigning the symbol text upon the Symbol Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnFine_Click(object sender, ImageClickEventArgs e)
        {
            Session["Symbol"] = "Fine";
        }

        /// <summary>
        /// This function is used for assigning the symbol text upon the Symbol Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnsad_Click(object sender, ImageClickEventArgs e)
        {
            Session["Symbol"] = "Sad";
        }

        /// <summary>
        /// This function is used for assigning the symbol text upon the Symbol Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnverysad_Click(object sender, ImageClickEventArgs e)
        {
            Session["Symbol"] = "Angry";
        }

        /// <summary>
        /// This function is used for sending the feedback message by the user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSend_Click(object sender, ImageClickEventArgs e)
        {
            FeedbackType = Session["FeedbackType"].ToString();
            //If Feedback panel is visible
            if (FeedbackType.Equals("Technical"))
            {
                string s = "pnlFeedbackTechnical";
                string s1 = s.Substring(11);
                string feedbackText = txtFeedbackTechnical.Text;
                dc.Insert_Feedback(@FeedbackSymbol, @s1, @feedbackText);
            }
            //If Feedback1 panel is visible
            else if (FeedbackType.Equals("Suggestion"))
            {
                string s = "pnlFeedbackSuggestion";
                string s1 = s.Substring(11);
                string feedbackText = txtFeedbackTechnical.Text;
                dc.Insert_Feedback(@FeedbackSymbol, @s1, @feedbackText);
            }
            //If Feedback panel is visible
            else if (FeedbackType.Equals("Complaints"))
            {
                string s = "pnlFeedbackComplaint";
                string s1 = s.Substring(11);
                string feedbackText = txtFeedbackTechnical.Text;
                dc.Insert_Feedback(@FeedbackSymbol, @s1, @feedbackText);
            }
        }

        /// <summary>
        /// This function is used for controling the visibility of a panel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnTechnical_Click1(object sender, ImageClickEventArgs e)
        {
            FeedbackType = "Technical";
            Session["FeedbackType"] = FeedbackType;
            pnlFeedbackTechnical.Visible = true;
        }

        /// <summary>
        /// This function is used for controling the visibility of a panel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSuggestion_Click(object sender, ImageClickEventArgs e)
        {
            FeedbackType = "Suggestion";
            Session["FeedbackType"] = FeedbackType;
            pnlFeedbackTechnical.Visible = true;
        }

        /// <summary>
        /// This function is used for controling the visibility of a panel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnComplaints_Click(object sender, ImageClickEventArgs e)
        {
            FeedbackType = "Complaints";
            Session["FeedbackType"] = FeedbackType;
            pnlFeedbackTechnical.Visible = true;
        }

    }
}

